package com.tancire.net.service.impl;

import java.util.List;
import javax.annotation.Resource;

import com.tancire.common.utils.DateUtils;
import org.springframework.stereotype.Service;
import com.tancire.net.mapper.CrmCompanyIncomeMapper;
import com.tancire.net.domain.CrmCompanyIncome;
import com.tancire.net.service.ICrmCompanyIncomeService;

/**
 * 客户每日收益Service业务层处理
 *
 * @author chenchao
 * @date 2023-12-25
 */
@Service
public class CrmCompanyIncomeServiceImpl implements ICrmCompanyIncomeService {
    @Resource
    private CrmCompanyIncomeMapper crmCompanyIncomeMapper;

    /**
     * 查询客户每日收益
     *
     * @param id 客户每日收益主键
     * @return 客户每日收益
     */
    @Override
    public CrmCompanyIncome selectCrmCompanyIncomeById(Long id) {
        return crmCompanyIncomeMapper.selectCrmCompanyIncomeById(id);
    }

    /**
     * 查询客户每日收益列表
     *
     * @param crmCompanyIncome 客户每日收益
     * @return 客户每日收益
     */
    @Override
    public List<CrmCompanyIncome> selectCrmCompanyIncomeList(CrmCompanyIncome crmCompanyIncome) {
        return crmCompanyIncomeMapper.selectCrmCompanyIncomeList(crmCompanyIncome);
    }

    /**
     * 新增客户每日收益
     *
     * @param crmCompanyIncome 客户每日收益
     * @return 结果
     */
    @Override
    public int insertCrmCompanyIncome(CrmCompanyIncome crmCompanyIncome) {
        crmCompanyIncome.setCreateTime(DateUtils.getNowDate());
        return crmCompanyIncomeMapper.insertCrmCompanyIncome(crmCompanyIncome);
    }

    /**
     * 修改客户每日收益
     *
     * @param crmCompanyIncome 客户每日收益
     * @return 结果
     */
    @Override
    public int updateCrmCompanyIncome(CrmCompanyIncome crmCompanyIncome) {
        crmCompanyIncome.setUpdateTime(DateUtils.getNowDate());
        return crmCompanyIncomeMapper.updateCrmCompanyIncome(crmCompanyIncome);
    }

    /**
     * 批量删除客户每日收益
     *
     * @param ids 需要删除的客户每日收益主键
     * @return 结果
     */
    @Override
    public int deleteCrmCompanyIncomeByIds(Long[] ids) {
        return crmCompanyIncomeMapper.deleteCrmCompanyIncomeByIds(ids);
    }

    /**
     * 删除客户每日收益信息
     *
     * @param id 客户每日收益主键
     * @return 结果
     */
    @Override
    public int deleteCrmCompanyIncomeById(Long id) {
        return crmCompanyIncomeMapper.deleteCrmCompanyIncomeById(id);
    }

    /**
     * 更新预估收益
     *
     * @param income
     */
    @Override
    public void updateIncomeAmount(CrmCompanyIncome income) {
        this.crmCompanyIncomeMapper.updateIncomeAmount(income);
    }
}
